<template>
	<view class="mainPage">
		<view class="title">请选择</view>
		<view class="list">
			<view class="list-li" v-for="(item,index) in areaList" :key="index" @tap="city(item)">
				{{item.areaName}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
			   areaList:[]
			}
		},
		onLoad() {
			this.getAreaList();
		},
		onShow() {
		
		},
		
		methods: {
			getAreaList(){
				this.$u.get('gbarea/listAllArea').then(res => {
					console.log(res);
					let list=[];
					for(let i=0;i<res.length;i++){
						if(res[i].level==1){
							list.push(res[i])
						}
					}
					console.log(list)
					this.areaList=list;
				});
			},
			city(data){
				this.$u.route('/pages/other/areaSelect/areaSelectCity',{level:data.level,parentId:data.parentId,id:data.id});
			}
			
			
		}
	}
</script>

<style lang="scss">
	.mainPage {
		background-color: #fff;
		.title{
			padding-top: 20rpx;
			padding-bottom: 20rpx;
			padding-left: 30rpx;
			padding-right: 30rpx;
			background-color: #fdef8b;
		}
		.list{
			.list-li{
				padding-left: 30rpx;
				padding-right: 30rpx;
				padding-top: 20rpx;
				padding-bottom: 20rpx;
				border-bottom: 2rpx solid #efefef;
			}
		}
	
	}

	
</style>